Developer Documentation

QuickTime 4 API Documentation

3D Graphics Programming with QuickDraw 3D 1.5.4

Previous | QD3D Book | Overview | Chapter Contents | Next |

Matrices

QuickDraw 3D defines 3-by-3 and 4-by-4 matrices as structures containing two-dimensional arrays of floating-point numbers as the single field in the structure. This convention allows for easy structure copying and for passing matrix parameters either by value or by reference. In a C language two-dimensional array, the second index varies fastest; accordingly, you can think of the first index as representing the matrix row and the second index as representing the matrix column. For example, consider the 3-by-3 matrix A defined like this:

Here, A [0][0] is the matrix element a , and A [2][1] is the matrix element h .

Matrices are defined by the TQ3Matrix3x3 and TQ3Matrix4x4 data types.

Remember that arrays in C are indexed starting with 0.

typedef struct TQ3Matrix3x3 {
    float                               value[3][3];
} TQ3Matrix3x3;
typedef struct TQ3Matrix4x4 {
    float                               value[4][4];
} TQ3Matrix4x4;
value
An array of floating-point values that define the matrix.

© 1997 Apple Computer, Inc.

Previous | QD3D Book | Overview | Chapter Contents | Next |